package com.leyou.item.dto;

import java.util.List;
import java.util.stream.Collectors;

public class CategorySubDTO {

    private Long id;
    private String name;

    public CategorySubDTO(Long id, String name) {
        this.id = id;
        this.name = name;
    }

    public CategorySubDTO() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static List<CategorySubDTO> ofDTOs(List<Category> list){
        return list.stream().map(x-> new CategorySubDTO(x.getId(),x.getName())).collect(Collectors.toList());
    }
}
